import { _decorator, Component, profiler } from 'cc';
const { ccclass, executeInEditMode, property } = _decorator;

@ccclass('FlowLightDemo')
@executeInEditMode
export class FlowLightDemo extends Component {
    private scanLight: gi.FlowLight = null;
    protected onLoad(): void {
        profiler.hideStats();
        this.scanLight = this.node.getChildByPath('扫光演示/扫光').getComponent(gi.FlowLight);
    }
    protected update(dt: number): void {
        if (this.scanLight.ratio >= 1.5) {
            this.scanLight.ratio = 0;
            this.scanLight.angle = Math.random() * 360;
        } else {
            this.scanLight.ratio += 0.01;
        }
    }
}